﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using ZK.HardWareHelp.SDK;

namespace ZK.HardWareHelp
{
    public class Onbon6E1XCard
    {
        static Onbon6E1XCardSDK.EQareaHeader_G6 aheader;
        static Onbon6E1XCardSDK.EQSound_6G stSoundData = new Onbon6E1XCardSDK.EQSound_6G();
        static Onbon6E1XCardSDK.EQpageHeader_G6 pheader;
        static Onbon6E1XCardSDK.DynamicAreaParams[] Params = new Onbon6E1XCardSDK.DynamicAreaParams[1];


        public Onbon6E1XCard()
        {

        }
        public static int InitSdk()
        {

            {
                aheader.AreaType = 0x00;
                aheader.AreaX = 0;
                aheader.AreaY = 0;
                aheader.AreaWidth = 96;
                aheader.AreaHeight = 48;
                aheader.BackGroundFlag = 0x00;
                aheader.Transparency = 101;
                aheader.AreaEqual = 0x00;
            }

            {
                stSoundData.SoundFlag = 0;
                stSoundData.SoundVolum = 0;
                stSoundData.SoundSpeed = 0;
                stSoundData.SoundDataMode = 0;
                stSoundData.SoundReplayTimes = 0;
                stSoundData.SoundReplayDelay = 0;
                stSoundData.SoundReservedParaLen = 0;
                stSoundData.Soundnumdeal = 0;
                stSoundData.Soundlanguages = 0;
                stSoundData.Soundwordstyle = 0;
                stSoundData.SoundDataLen = 0;
                byte[] t = new byte[1];
                t[0] = 0;
                stSoundData.SoundData = t;
            }

            {
                pheader.PageStyle = 0x00;
                pheader.DisplayMode = 0x02;
                pheader.ClearMode = 0x01;
                pheader.Speed = 15;
                pheader.StayTime = 500;
                pheader.RepeatTime = 1;
                pheader.ValidLen = 0;
                pheader.CartoonFrameRate = 0x00;
                pheader.BackNotValidFlag = 0x00;
                pheader.arrMode = Onbon6E1XCardSDK.E_arrMode.eMULTILINE;
                pheader.fontSize = 12;
                pheader.color = (uint)0x01;
                pheader.fontBold = 1;
                pheader.fontItalic = 0;
                pheader.tdirection = Onbon6E1XCardSDK.E_txtDirection.pNORMAL;
                pheader.txtSpace = 0;
                pheader.Valign = 2;
                pheader.Halign = 2;
            }

            int res = Onbon6E1XCardSDK.InitSdk();
            if (res != 0)
            {
                Common.DelegateHelper.InfoMessageEvent?.Invoke("仰邦led初始化结果失败！");
            }

            return res;
        }
        public static void Net_FILELIST(byte[] ip)
        {
            byte[] DirBlock = new byte[Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56))];
            Onbon6E1XCardSDK.GetDirBlock_G56 driBlock;
            int err = Onbon6E1XCardSDK.cmd_ofsReedDirBlock(ip, 5005, DirBlock);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56)));
            Marshal.Copy(DirBlock, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56)) * 0, dec, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56)));
            driBlock = (Onbon6E1XCardSDK.GetDirBlock_G56)Marshal.PtrToStructure(dec, typeof(Onbon6E1XCardSDK.GetDirBlock_G56));
            Marshal.FreeHGlobal(dec);
            Console.WriteLine("fileNumber:" + driBlock.fileNumber);
            Console.WriteLine("dataAddre:" + driBlock.dataAddre);
            Console.WriteLine("\r\n");

            for (int i = 0; i < driBlock.fileNumber; i++)
            {
                byte[] FileAttribute = new byte[Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56))];
                Onbon6E1XCardSDK.FileAttribute_G56 fileAttr;
                err = Onbon6E1XCardSDK.cmd_getFileAttr(DirBlock, i, FileAttribute);
                dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56)));
                Marshal.Copy(FileAttribute, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56)) * 0, dec, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56)));
                fileAttr = (Onbon6E1XCardSDK.FileAttribute_G56)Marshal.PtrToStructure(dec, typeof(Onbon6E1XCardSDK.FileAttribute_G56));
                Marshal.FreeHGlobal(dec);
                Console.WriteLine("fileName:" + Encoding.Default.GetString(fileAttr.fileName));
                Console.WriteLine("fileType:" + fileAttr.fileType);
                Console.WriteLine("fileLen:" + fileAttr.fileLen);
                Console.WriteLine("fileCRC:" + fileAttr.fileCRC);
                Console.WriteLine("\r\n");

                err = Onbon6E1XCardSDK.cmd_ofsDeleteFormatFile(ip, 5005, 1, Encoding.Default.GetString(fileAttr.fileName));
            }
        }
        //网口搜索
        public static void Net_search()
        {
            byte[] arrPointer = new byte[Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data))];
            Onbon6E1XCardSDK.Ping_data data;
            int err = Onbon6E1XCardSDK.cmd_udpPing(arrPointer);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data)));
            Marshal.Copy(arrPointer, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data)) * 0, dec, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data)));
            data = (Onbon6E1XCardSDK.Ping_data)Marshal.PtrToStructure(dec, typeof(Onbon6E1XCardSDK.Ping_data));
            Marshal.FreeHGlobal(dec);
            Console.WriteLine("ControllerType:0x" + data.ControllerType.ToString("X2"));
            Console.WriteLine("FirmwareVersion:V" + System.Text.Encoding.Default.GetString(data.FirmwareVersion));
            Console.WriteLine("ipAdder:" + System.Text.Encoding.Default.GetString(data.ipAdder));
            Console.WriteLine("\r\n");
        }
        #region
        /*
        //网口-5代发送文本
        public static void Net_G5_str()
        {
            byte[] ip = Encoding.Default.GetBytes("182.168.0.199");
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 333, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x05;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x04;
            header.ProgramLifeSpan_ed = 0x12;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram(aa);
            Console.WriteLine("program_addProgram:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader aheader;
            aheader.AreaType = 0x00;
            aheader.AreaX = 0;
            aheader.AreaY = 0;
            aheader.AreaWidth = 384;
            aheader.AreaHeight = 32;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_AddArea(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            OnbonBx_sdk_dualSDK.EQpageHeader pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x03;
            pheader.ClearMode = 0x01;
            pheader.Speed = 30;
            pheader.StayTime = 0;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 12;
            pheader.color = (uint)OnbonBx_sdk_dualSDK.E_Color_G56.eGREEN;
            pheader.fontBold = false;
            pheader.fontItalic = false;
            pheader.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQpageHeader)));
            Marshal.StructureToPtr(pheader, cc, false);
            err = OnbonBx_sdk_dualSDK.program_picturesAreaAddTxt(0, str, font, cc);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);


            //OnbonBx_sdk_dualSDK.getPageData pageData;
            //pageData.allPageNub = 0;
            //pageData.pageLen=0;
            //pageData.fileAddre=null;
            //err = OnbonBx_sdk_dualSDK.program_pictureAreaGetOnePage(0, 0, ref pageData);


            err = OnbonBx_sdk_dualSDK.cmd_ofsStartFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            program = (OnbonBx_sdk_dualSDK.EQprogram)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsEndFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //网口-5代发送图片
        public static void Net_G5_bmp()
        {
            byte[] ip = Encoding.Default.GetBytes("182.168.0.199");
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 233, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_2);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x05;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x04;
            header.ProgramLifeSpan_ed = 0x12;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram(aa);
            Console.WriteLine("program_addProgram:" + err);


            OnbonBx_sdk_dualSDK.EQareaHeader aheader;
            aheader.AreaType = 0x00;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 32;
            aheader.AreaHeight = 32;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_AddArea(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            OnbonBx_sdk_dualSDK.EQpageHeader pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x01;
            pheader.ClearMode = 0x01;
            pheader.Speed = 30;
            pheader.StayTime = 0;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 12;
            pheader.color = (uint)OnbonBx_sdk_dualSDK.E_Color_G56.eGREEN;
            pheader.fontBold = false;
            pheader.fontItalic = false;
            pheader.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            //err = OnbonBx_sdk_dualSDK.program_picturesAreaAddTxt(0, str, font, ref pheader);
            //Console.WriteLine("program_picturesAreaAddTxt:" + err);
            byte[] img = Encoding.Default.GetBytes("32.png");
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQpageHeader)));
            Marshal.StructureToPtr(pheader, cc, false);
            err = OnbonBx_sdk_dualSDK.program_pictureAreaAddPic(0, 0, cc, img);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);


            err = OnbonBx_sdk_dualSDK.cmd_ofsStartFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            program = (OnbonBx_sdk_dualSDK.EQprogram)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsEndFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //网口-5代发送时间
        public static void Net_G5_time()
        {
            byte[] ip = Encoding.Default.GetBytes("182.168.0.199");
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 233, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_2);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x05;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x04;
            header.ProgramLifeSpan_ed = 0x12;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram(aa);
            Console.WriteLine("program_addProgram:" + err);


            OnbonBx_sdk_dualSDK.EQareaHeader aheader;
            aheader.AreaType = 0x02;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_AddArea(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            OnbonBx_sdk_dualSDK.EQtimeAreaData_G56 timeData2;
            timeData2.linestyle = OnbonBx_sdk_dualSDK.E_arrMode.eMULTILINE;
            timeData2.color = (uint)OnbonBx_sdk_dualSDK.E_Color_G56.eGREEN;
            timeData2.fontName = "";
            timeData2.fontSize = 16;
            timeData2.fontBold = 0;
            timeData2.fontItalic = 0;
            timeData2.fontUnderline = 0;
            timeData2.fontAlign = 1;  //0--左对齐，1-居中，2-右对齐
            timeData2.date_enable = true;
            timeData2.datestyle = OnbonBx_sdk_dualSDK.E_DateStyle.eYYYY_MM_DD_MINUS;
            timeData2.time_enable = false;
            timeData2.timestyle = OnbonBx_sdk_dualSDK.E_TimeStyle.eHH_MM_SS_COLON;
            timeData2.week_enable = false;
            timeData2.weekstyle = OnbonBx_sdk_dualSDK.E_WeekStyle.eMonday_CHS;

            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQtimeAreaData_G56)));
            Marshal.StructureToPtr(timeData2, cc, false);
            err = OnbonBx_sdk_dualSDK.program_fontPath_timeAreaAddContent(0, cc);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);


            err = OnbonBx_sdk_dualSDK.cmd_ofsStartFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);
            byte[] arrProgram = new byte[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            program = (OnbonBx_sdk_dualSDK.EQprogram)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsEndFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //网口-5代发送表盘
        public static void Net_G5_clock()
        {
            byte[] ip = Encoding.Default.GetBytes("182.168.0.199");
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 233, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_2);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x05;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x04;
            header.ProgramLifeSpan_ed = 0x12;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram(aa);
            Console.WriteLine("program_addProgram:" + err);


            OnbonBx_sdk_dualSDK.EQareaHeader aheader;
            aheader.AreaType = 0x02;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_AddArea(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            OnbonBx_sdk_dualSDK.EQAnalogClockHeader_G56 acheader;
            acheader.OrignPointX = 32;
            acheader.OrignPointY = 16;
            acheader.UnitMode = 0x00;
            acheader.HourHandWidth = 0x02;
            acheader.HourHandLen = 0x08;
            acheader.HourHandColor = 0x01;
            acheader.MinHandWidth = 0x02;
            acheader.MinHandLen = 0x0b;
            acheader.MinHandColor = 0x01;
            acheader.SecHandWidth = 0x02;
            acheader.SecHandLen = 0x0d;
            acheader.SecHandColor = 0x01;

            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQAnalogClockHeader_G56)));
            Marshal.StructureToPtr(acheader, cc, false);
            OnbonBx_sdk_dualSDK.ClockColor_G56 ClockColor;
            ClockColor.Color369 = 0xff0000;
            ClockColor.ColorDot = 0xff0000;
            ClockColor.ColorBG = 0xff0000;
            err = OnbonBx_sdk_dualSDK.program_timeAreaAddAnalogClock(0, cc, OnbonBx_sdk_dualSDK.E_ClockStyle.eSQUARE, ref ClockColor);

            err = OnbonBx_sdk_dualSDK.cmd_ofsStartFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);
            byte[] arrProgram = new byte[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            program = (OnbonBx_sdk_dualSDK.EQprogram)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsEndFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //网口-6代发送文本
        public static void Net_G6_str()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_FULLCOLOR, 0x166, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0x0;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = 0x00;
            aheader.AreaX = 0;
            aheader.AreaY = 0;
            aheader.AreaWidth = 128;
            aheader.AreaHeight = 96;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_addArea_G6(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            byte[] str = Encoding.Default.GetBytes("3Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            OnbonBx_sdk_dualSDK.EQpageHeader_G6 pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x03;
            pheader.ClearMode = 0x01;
            pheader.Speed = 15;
            pheader.StayTime = 500;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.CartoonFrameRate = 0x00;
            pheader.BackNotValidFlag = 0x00;
            pheader.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 18;
            pheader.color = (uint)0x01;
            pheader.fontBold = 0;
            pheader.fontItalic = 0;
            pheader.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQpageHeader_G6)));
            Marshal.StructureToPtr(pheader, cc, false);
            err = OnbonBx_sdk_dualSDK.program_picturesAreaAddTxt_G6(0, str, font, cc);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);

            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram_G6 program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            program = (OnbonBx_sdk_dualSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            byte[] ip = Encoding.ASCII.GetBytes("192.168.89.105");
            err = OnbonBx_sdk_dualSDK.cmd_ofsStartFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);

            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsEndFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //网口-6代发送时间
        public static void Net_G6_time()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_FULLCOLOR, 0x166, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram_G6:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = 0x02;
            aheader.AreaX = 0;
            aheader.AreaY = 0;
            aheader.AreaWidth = 128;
            aheader.AreaHeight = 64;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_addArea_G6(1, bb);  //添加图文区域
            Console.WriteLine("program_addArea_G6:" + err);

            //OnbonBx_sdk_dualSDK.EQTimeAreaBattle_G6 bheader;
            //bheader.BattleStartYear = 2019;
            //bheader.BattleStartMonth = 4;
            //bheader.BattleStartDate = 1;
            //bheader.BattleStartHour = 12;
            //bheader.BattleStartMinute = 0;
            //bheader.BattleStartSecond = 0;
            //bheader.BattleStartWeek = 1;
            //bheader.StartUpMode = 0;
            //IntPtr dd = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQTimeAreaBattle_G6)));
            //Marshal.StructureToPtr(aheader, bb, false);
            //err = OnbonBx_sdk_dualSDK.program_timeAreaSetBattleTime_G6(1, dd);
            //Console.WriteLine("program_timeAreaSetBattleTime_G6:" + err);

            err = OnbonBx_sdk_dualSDK.program_timeAreaCancleBattleTime_G6(1);
            Console.WriteLine("program_timeAreaCancleBattleTime_G6:" + err);

            OnbonBx_sdk_dualSDK.EQtimeAreaData_G56 timeData2;
            timeData2.linestyle = OnbonBx_sdk_dualSDK.E_arrMode.eMULTILINE;
            timeData2.color = (uint)OnbonBx_sdk_dualSDK.E_Color_G56.eGREEN;
            timeData2.fontName = "";
            timeData2.fontSize = 16;
            timeData2.fontBold = 0;
            timeData2.fontItalic = 0;
            timeData2.fontUnderline = 0;
            timeData2.fontAlign = 1;  //0--左对齐，1-居中，2-右对齐
            timeData2.date_enable = true;
            timeData2.datestyle = OnbonBx_sdk_dualSDK.E_DateStyle.eYYYY_MM_DD_MINUS;
            timeData2.time_enable = true;
            timeData2.timestyle = OnbonBx_sdk_dualSDK.E_TimeStyle.eHH_MM_SS_COLON;
            timeData2.week_enable = true;
            timeData2.weekstyle = OnbonBx_sdk_dualSDK.E_WeekStyle.eMonday_CHS;
            //program_timeAreaAddContent_G6(1,&timeData);
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQtimeAreaData_G56)));
            Marshal.StructureToPtr(timeData2, cc, false);
            err = OnbonBx_sdk_dualSDK.program_fontPath_timeAreaAddContent_G6(1, cc);
            Console.WriteLine("program_fontPath_timeAreaAddContent_G6:" + err);

            byte[] ip = Encoding.Default.GetBytes("192.168.89.105");
            err = OnbonBx_sdk_dualSDK.cmd_ofsStartFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);

            Console.WriteLine("program_IntegrateProgramFile:" + err);
            byte[] arrProgram = new byte[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6))];
            OnbonBx_sdk_dualSDK.EQprogram_G6 program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            program = (OnbonBx_sdk_dualSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsEndFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //网口-6代发送表盘
        public static void Net_G6_clock()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 0x474, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = 0x02;
            aheader.AreaX = 0;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_addArea_G6(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            OnbonBx_sdk_dualSDK.EQAnalogClockHeader_G56 acheader;
            acheader.OrignPointX = 32;
            acheader.OrignPointY = 16;
            acheader.UnitMode = 0x00;
            acheader.HourHandWidth = 0x02;
            acheader.HourHandLen = 0x08;
            acheader.HourHandColor = 0x01;
            acheader.MinHandWidth = 0x02;
            acheader.MinHandLen = 0x0b;
            acheader.MinHandColor = 0x01;
            acheader.SecHandWidth = 0x02;
            acheader.SecHandLen = 0x0d;
            acheader.SecHandColor = 0x01;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQAnalogClockHeader_G56)));
            Marshal.StructureToPtr(acheader, cc, false);
            OnbonBx_sdk_dualSDK.ClockColor_G56 ClockColor;
            ClockColor.Color369 = 0xff0000;
            ClockColor.ColorDot = 0xff0000;
            ClockColor.ColorBG = 0xff0000;
            err = OnbonBx_sdk_dualSDK.program_timeAreaAddAnalogClock_G6(0, cc, OnbonBx_sdk_dualSDK.E_ClockStyle.eCIRCLE, ClockColor);

            byte[] ip = Encoding.Default.GetBytes("192.168.89.182");
            err = OnbonBx_sdk_dualSDK.cmd_ofsStartFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);

            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram_G6 program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            program = (OnbonBx_sdk_dualSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsWriteFile(ip, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_ofsEndFileTransf(ip, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        */
        #endregion

        //串口搜索
        public static void COM_search()
        {
            byte[] COMPort = Encoding.Default.GetBytes("COM7");
            byte[] arrPointer = new byte[Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data))];
            Onbon6E1XCardSDK.Ping_data data;
            int ret = Onbon6E1XCardSDK.cmd_uart_searchController(arrPointer, COMPort);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data)));
            Marshal.Copy(arrPointer, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data)) * 0, dec, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.Ping_data)));
            data = (Onbon6E1XCardSDK.Ping_data)Marshal.PtrToStructure(dec, typeof(Onbon6E1XCardSDK.Ping_data));
            Marshal.FreeHGlobal(dec);
            Console.WriteLine("ControllerType:0x" + data.ControllerType.ToString("X2"));
            Console.WriteLine("FirmwareVersion:V" + System.Text.Encoding.Default.GetString(data.FirmwareVersion));
            Console.WriteLine("ipAdder:" + System.Text.Encoding.Default.GetString(data.ipAdder));
            Console.WriteLine("\r\n");
        }

        #region
        /*
        //串口-5代发送文本
        public static void COM_G5_txt()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 0x354, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x05;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x04;
            header.ProgramLifeSpan_ed = 0x12;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram(aa);
            Console.WriteLine("program_addProgram:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader aheader;
            aheader.AreaType = 0x00;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_AddArea(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            OnbonBx_sdk_dualSDK.EQpageHeader pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x03;
            pheader.ClearMode = 0x01;
            pheader.Speed = 30;
            pheader.StayTime = 0;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 12;
            pheader.color = (uint)OnbonBx_sdk_dualSDK.E_Color_G56.eGREEN;
            pheader.fontBold = false;
            pheader.fontItalic = false;
            pheader.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQpageHeader)));
            Marshal.StructureToPtr(pheader, cc, false);
            err = OnbonBx_sdk_dualSDK.program_picturesAreaAddTxt(0, str, font, cc);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);


            byte[] com = Encoding.Default.GetBytes("COM7");
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsStartFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsStartFileTransf:" + err);

            Console.WriteLine("program_IntegrateProgramFile:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram)));
            program = (OnbonBx_sdk_dualSDK.EQprogram)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsEndFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //串口-6代发送图片
        public static void COM_G6_bmp()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 0x274, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = 0x00;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_addArea_G6(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            OnbonBx_sdk_dualSDK.EQpageHeader_G6 pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x03;
            pheader.ClearMode = 0x01;
            pheader.Speed = 15;
            pheader.StayTime = 500;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.CartoonFrameRate = 0x00;
            pheader.BackNotValidFlag = 0x00;
            pheader.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 10;
            pheader.color = (uint)0x01;
            pheader.fontBold = 0;
            pheader.fontItalic = 0;
            pheader.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            byte[] img = Encoding.Default.GetBytes("32.png");
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQpageHeader_G6)));
            Marshal.StructureToPtr(pheader, cc, false);
            err = OnbonBx_sdk_dualSDK.program_pictureAreaAddPic_G6(0, 0, cc, img);
            Console.WriteLine("program_pictureAreaAddPic_G6:" + err);


            byte[] com = Encoding.Default.GetBytes("COM7");
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsStartFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsStartFileTransf:" + err);

            Console.WriteLine("program_IntegrateProgramFile:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram_G6 program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            program = (OnbonBx_sdk_dualSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsEndFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //串口-6代发送文本
        public static void COM_G6_str()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 0x166, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0x10;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = 0x00;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_addArea_G6(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);

            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            OnbonBx_sdk_dualSDK.EQpageHeader_G6 pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x01;
            pheader.ClearMode = 0x01;
            pheader.Speed = 15;
            pheader.StayTime = 500;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.CartoonFrameRate = 0x00;
            pheader.BackNotValidFlag = 0x00;
            pheader.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eMULTILINE;
            pheader.fontSize = 10;
            pheader.color = (uint)0x01;
            pheader.fontBold = 0;
            pheader.fontItalic = 0;
            pheader.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 1;
            pheader.Halign = 0;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQpageHeader_G6)));
            Marshal.StructureToPtr(pheader, cc, false);
            err = OnbonBx_sdk_dualSDK.program_picturesAreaAddTxt_G6(0, str, font, cc);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);

            Console.WriteLine("program_IntegrateProgramFile:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram_G6 program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            program = (OnbonBx_sdk_dualSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            byte[] buffer_dfileAddre = new byte[program.fileLen];
            Marshal.Copy(program.dfileAddre, buffer_dfileAddre, 0, (int)program.dfileAddre);
            MemoryStream m = new MemoryStream(buffer_dfileAddre);
            string file_dfileAddre = string.Format("D://dfileAddre.bin");//可根据文件类型自定义后缀
            FileStream fs = new FileStream(file_dfileAddre, FileMode.OpenOrCreate);
            m.WriteTo(fs);
            m.Close();
            fs.Close();
            byte[] buffer_fileAddre = new byte[program.fileLen];
            Marshal.Copy(program.fileAddre, buffer_fileAddre, 0, (int)program.fileLen);
            MemoryStream n = new MemoryStream(buffer_fileAddre);
            string file_fileAddre = string.Format("D://fileAddre.bin");//可根据文件类型自定义后缀
            FileStream fi = new FileStream(file_fileAddre, FileMode.OpenOrCreate);
            n.WriteTo(fs);
            n.Close();
            fi.Close();

            byte[] com = Encoding.Default.GetBytes("COM7");
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsStartFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsStartFileTransf:" + err);

            FileStream readStream1 = new FileStream("D://dfileAddre.bin", FileMode.Open);
            byte[] dfileAddredata = new byte[readStream1.Length];
            IntPtr dfileAddre = BytesToIntptr(dfileAddredata);
            FileStream readStream2 = new FileStream("D://fileAddre.bin", FileMode.Open);
            byte[] fileAddredata = new byte[readStream2.Length];
            IntPtr fileAddre = BytesToIntptr(fileAddredata);

            //err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.dfileName, program.dfileType, (uint)readStream1.Length, 1, dfileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            //err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.fileName, program.fileType, (uint)readStream2.Length, 1, fileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsEndFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        //串口-6代发送时间
        public static void COM_G6_time()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 0x274, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram_G6:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = 0x02;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_addArea_G6(0, bb);  //添加图文区域
            Console.WriteLine("program_addArea_G6:" + err);


            OnbonBx_sdk_dualSDK.EQTimeAreaBattle_G6 bheader;
            bheader.BattleStartYear = 2019;
            bheader.BattleStartMonth = 4;
            bheader.BattleStartDate = 1;
            bheader.BattleStartHour = 12;
            bheader.BattleStartMinute = 0;
            bheader.BattleStartSecond = 0;
            bheader.BattleStartWeek = 1;
            bheader.StartUpMode = 0;
            IntPtr dd = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQTimeAreaBattle_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_timeAreaSetBattleTime_G6(1, dd);
            Console.WriteLine("program_timeAreaSetBattleTime_G6:" + err);

            err = OnbonBx_sdk_dualSDK.program_timeAreaCancleBattleTime_G6(1);
            Console.WriteLine("program_timeAreaCancleBattleTime_G6:" + err);

            OnbonBx_sdk_dualSDK.EQtimeAreaData_G56 timeData2;
            timeData2.linestyle = OnbonBx_sdk_dualSDK.E_arrMode.eMULTILINE;
            timeData2.color = (uint)OnbonBx_sdk_dualSDK.E_Color_G56.eGREEN;
            timeData2.fontName = "";
            timeData2.fontSize = 16;
            timeData2.fontBold = 0;
            timeData2.fontItalic = 0;
            timeData2.fontUnderline = 0;
            timeData2.fontAlign = 1;  //0--左对齐，1-居中，2-右对齐
            timeData2.date_enable = true;
            timeData2.datestyle = OnbonBx_sdk_dualSDK.E_DateStyle.eYYYY_MM_DD_MINUS;
            timeData2.time_enable = false;
            timeData2.timestyle = OnbonBx_sdk_dualSDK.E_TimeStyle.eHH_MM_SS_COLON;
            timeData2.week_enable = false;
            timeData2.weekstyle = OnbonBx_sdk_dualSDK.E_WeekStyle.eMonday_CHS;
            //program_timeAreaAddContent_G6(1,&timeData);
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQtimeAreaData_G56)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_fontPath_timeAreaAddContent_G6(1, cc);
            Console.WriteLine("program_fontPath_timeAreaAddContent_G6:" + err);


            byte[] com = Encoding.Default.GetBytes("COM7");
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsStartFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsStartFileTransf:" + err);

            Console.WriteLine("program_IntegrateProgramFile:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram_G6 program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile_G6:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            program = (OnbonBx_sdk_dualSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsEndFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram_G6:" + err);
        }
        //串口-6代发送表盘
        public static void COM_G6_clock()
        {
            int err = OnbonBx_sdk_dualSDK.program_setScreenParams_G56(OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, 0x274, OnbonBx_sdk_dualSDK.E_DoubleColorPixel_G56.eDOUBLE_COLOR_PIXTYPE_1);
            Console.WriteLine("program_setScreenParams_G56:" + err);

            OnbonBx_sdk_dualSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            err = OnbonBx_sdk_dualSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram:" + err);

            OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = 0x02;
            aheader.AreaX = 16;
            aheader.AreaY = 0;
            aheader.AreaWidth = 64;
            aheader.AreaHeight = 32;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            err = OnbonBx_sdk_dualSDK.program_addArea_G6(0, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);


            OnbonBx_sdk_dualSDK.EQAnalogClockHeader_G56 acheader;
            acheader.OrignPointX = 32;
            acheader.OrignPointY = 16;
            acheader.UnitMode = 0x00;
            acheader.HourHandWidth = 0x02;
            acheader.HourHandLen = 0x08;
            acheader.HourHandColor = 0x01;
            acheader.MinHandWidth = 0x02;
            acheader.MinHandLen = 0x0b;
            acheader.MinHandColor = 0x01;
            acheader.SecHandWidth = 0x02;
            acheader.SecHandLen = 0x0d;
            acheader.SecHandColor = 0x01;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQAnalogClockHeader_G56)));
            Marshal.StructureToPtr(acheader, cc, false);
            OnbonBx_sdk_dualSDK.ClockColor_G56 ClockColor;
            ClockColor.Color369 = 0xff0000;
            ClockColor.ColorDot = 0xff0000;
            ClockColor.ColorBG = 0xff0000;
            err = OnbonBx_sdk_dualSDK.program_timeAreaAddAnalogClock(0, cc, OnbonBx_sdk_dualSDK.E_ClockStyle.eCIRCLE, ref ClockColor);


            byte[] com = Encoding.Default.GetBytes("COM7");
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsStartFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsStartFileTransf:" + err);

            Console.WriteLine("program_IntegrateProgramFile:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            OnbonBx_sdk_dualSDK.EQprogram_G6 program;
            err = OnbonBx_sdk_dualSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram_G6)));
            program = (OnbonBx_sdk_dualSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(OnbonBx_sdk_dualSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsWriteFile(com, 2, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_uart_ofsWriteFile:" + err);
            err = OnbonBx_sdk_dualSDK.cmd_uart_ofsEndFileTransf(com, 2);
            Console.WriteLine("cmd_uart_ofsEndFileTransf:" + err);
            err = OnbonBx_sdk_dualSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        */
        #endregion

        //更新动态区
        public static void dynamicArea_6(string msg, string ipStr)
        {
            int err = 0;
            //Console.Write("输入IP:");
            //byte[] ip = Encoding.Default.GetBytes(Console.ReadLine());
            byte[] ip = Encoding.Default.GetBytes(ipStr);
            // byte[] img = Encoding.Default.GetBytes("32.png");
            byte[] str = Encoding.Default.GetBytes(msg);
            byte[] font = Encoding.Default.GetBytes("黑体");
            //OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader;
            //aheader.AreaType = 0x00;
            //aheader.AreaX = 0;
            //aheader.AreaY = 0;
            //aheader.AreaWidth = 96;
            //aheader.AreaHeight = 48;
            //aheader.BackGroundFlag = 0x00;
            //aheader.Transparency = 101;
            //aheader.AreaEqual = 0x00;
            //OnbonBx_sdk_dualSDK.EQareaHeader_G6 aheader1;
            //aheader1.AreaType = 0x10;
            //aheader1.AreaX = 48;
            //aheader1.AreaY = 0;
            //aheader1.AreaWidth = 32;
            //aheader1.AreaHeight = 32;
            //aheader1.BackGroundFlag = 0x00;
            //aheader1.Transparency = 101;
            //aheader1.AreaEqual = 0x00;
            // OnbonBx_sdk_dualSDK.EQSound_6G stSoundData = new OnbonBx_sdk_dualSDK.EQSound_6G();
            //stSoundData.SoundFlag = 0;
            //stSoundData.SoundVolum = 0;
            //stSoundData.SoundSpeed = 0;
            //stSoundData.SoundDataMode = 0;
            //stSoundData.SoundReplayTimes = 0;
            //stSoundData.SoundReplayDelay = 0;
            //stSoundData.SoundReservedParaLen = 0;
            //stSoundData.Soundnumdeal = 0;
            //stSoundData.Soundlanguages = 0;
            //stSoundData.Soundwordstyle = 0;
            //stSoundData.SoundDataLen = 0;
            //byte[] t = new byte[1];
            //t[0] = 0;
            //stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            //aheader1.stSoundData = stSoundData;

            //string str = "Hello,LED789";
            // OnbonBx_sdk_dualSDK.EQpageHeader_G6 pheader;
            //pheader.PageStyle = 0x00;
            //pheader.DisplayMode = 0x02;
            //pheader.ClearMode = 0x01;
            //pheader.Speed = 15;
            //pheader.StayTime = 500;
            //pheader.RepeatTime = 1;
            //pheader.ValidLen = 0;
            //pheader.CartoonFrameRate = 0x00;
            //pheader.BackNotValidFlag = 0x00;
            //pheader.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eMULTILINE;
            //pheader.fontSize = 12;
            //pheader.color = (uint)0x01;
            //pheader.fontBold = 1;
            //pheader.fontItalic = 0;
            //pheader.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            //pheader.txtSpace = 0;
            //pheader.Valign = 2;
            //pheader.Halign = 2;


            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, aa, false);
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQpageHeader_G6)));
            Marshal.StructureToPtr(pheader, bb, false);
            //OnbonBx_sdk_dualSDK.EQpageHeader_G6 pheader1;
            //pheader1.PageStyle = 0x00;
            //pheader1.DisplayMode = 0x03;
            //pheader1.ClearMode = 0x01;
            //pheader1.Speed = 15;
            //pheader1.StayTime = 500;
            //pheader1.RepeatTime = 1;
            //pheader1.ValidLen = 0;
            //pheader1.CartoonFrameRate = 0x00;
            //pheader1.BackNotValidFlag = 0x00;
            //pheader1.arrMode = OnbonBx_sdk_dualSDK.E_arrMode.eSINGLELINE;
            //pheader1.fontSize = 18;
            //pheader1.color = (uint)0x01;
            //pheader1.fontBold = 0;
            //pheader1.fontItalic = 0;
            //pheader1.tdirection = OnbonBx_sdk_dualSDK.E_txtDirection.pNORMAL;
            //pheader1.txtSpace = 0;
            //pheader1.Valign = 2;
            //pheader1.Halign = 2;
            //IntPtr aa1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQareaHeader_G6)));
            // Marshal.StructureToPtr(aheader1, aa1, false);
            // IntPtr bb1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQpageHeader_G6)));
            // Marshal.StructureToPtr(pheader1, bb1, false);
            //删除单个动态区 zc
            //err = OnbonBx_sdk_dualSDK.dynamicArea_DelArea_6G(ip, 5005, 0xff);
            //Console.WriteLine("dynamicArea_DelArea_6G = " + err);
            //单区域文本 zc
            //err = OnbonBx_sdk_dualSDK.dynamicArea_AddAreaTxt_6G(ip, 5005, OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_SINGLE, 0, 0, 0,96
            // , 48, font, 12, str);
            //Console.WriteLine("dynamicArea_AddAreaTxt_6G = " + err);
            //单区域图片 zc
            //err = OnbonBx_sdk_dualSDK.dynamicArea_AddAreaPic_6G(ip, 5005, OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_FULLCOLOR, 0, 0, 0,
            //32, 32, bb, img);
            //Console.WriteLine("dynamicArea_AddAreaPic_6G = " + err);

            //更新动态区，可设置属性 zc
            err = Onbon6E1XCardSDK.dynamicArea_AddAreaTxtDetails_6G(ip, 5005, Onbon6E1XCardSDK.E_ScreenColor_G56.eSCREEN_COLOR_SINGLE, 0,
                aa, bb, font, str);
            //Console.WriteLine("dynamicArea_AddAreaTxtDetails_6G = " + err);

            //关联节目 zc
            //ushort[] RelateProSerial = new ushort[1] { 0};
            //err = OnbonBx_sdk_dualSDK.dynamicArea_AddAreaTxtDetails_WithProgram_6G(ip, 5005, OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_FULLCOLOR, 0, aa, bb, font, str, 0, RelateProSerial);
            //Console.WriteLine("dynamicArea_AddAreaTxtDetails_WithProgram_6G = " + err);


            //OnbonBx_sdk_dualSDK.DynamicAreaParams[] Params = new OnbonBx_sdk_dualSDK.DynamicAreaParams[1];
            Params[0].uAreaId = 0;
            Params[0].oAreaHeader_G6 = aheader;
            Params[0].stPageHeader = pheader;
            Params[0].fontName = BytesToIntptr(font);
            Params[0].strAreaTxtContent = BytesToIntptr(str);
            // Params[1].uAreaId = 1;
            // Params[1].oAreaHeader_G6 = aheader1;
            //  Params[1].stPageHeader = pheader1;
            //  Params[1].fontName = BytesToIntptr(font);
            // Params[1].strAreaTxtContent = BytesToIntptr(img);

            // err = OnbonBx_sdk_dualSDK.dynamicAreaS_AddTxtDetails_6G(ip, 5005, OnbonBx_sdk_dualSDK.E_ScreenColor_G56.eSCREEN_COLOR_SINGLE, 1, Params);
            // Console.WriteLine("dynamicAreaS_AddTxtDetails_6G = " + err);
        }

        //byte[]转换为Intptr
        public static IntPtr BytesToIntptr(byte[] bytes)
        {
            int size = bytes.Length;
            IntPtr buffer = Marshal.AllocHGlobal(size);
            try
            {
                Marshal.Copy(bytes, 0, buffer, size);
                return buffer;
            }
            finally
            {
                //Marshal.FreeHGlobal(buffer);
            }
        }
        public static void dynamicArea_5()
        {
            int err = 0;
            //Console.Write("输入IP:");
            //byte[] ip = Encoding.Default.GetBytes(Console.ReadLine());
            byte[] ip = Encoding.Default.GetBytes("192.168.89.182");
            //删除单个动态区 zc
            err = Onbon6E1XCardSDK.dynamicArea_DelArea_5G(ip, 5005, 0xff);
            Console.WriteLine("dynamicArea_DelArea_5G = " + err);
            //单区域文本 zc
            byte uAreaId = 0;
            byte RunMode = 0;
            ushort Timeout = 10;
            byte RelateAllPro = 1;
            ushort RelateProNum = 0;
            ushort[] RelateProSerial = null;
            byte ImmePlay = 1;
            ushort uAreaX = 0;
            ushort uAreaY = 0;
            ushort uWidth = 64;
            ushort uHeight = 32;
            Onbon6E1XCardSDK.EQareaframeHeader oFrame;
            oFrame.AreaFFlag = 0;
            oFrame.AreaFDispStyle = 0;
            oFrame.AreaFDispSpeed = 0;
            oFrame.AreaFMoveStep = 0;
            oFrame.AreaFWidth = 0;
            oFrame.AreaFBackup = 0;
            //PageStyle begin--------
            byte DisplayMode = 3;
            byte ClearMode = 0;
            byte Speed = 10;
            ushort StayTime = 10;
            byte RepeatTime = 0;
            //PageStyle End.
            //显示内容和字体格式 begin---------
            Onbon6E1XCardSDK.EQfontData oFont;

            oFont.arrMode = Onbon6E1XCardSDK.E_arrMode.eMULTILINE;
            oFont.fontSize = 10;
            oFont.color = 1;
            oFont.fontBold = 0;
            oFont.fontItalic = 0; oFont.tdirection = Onbon6E1XCardSDK.E_txtDirection.pNORMAL; oFont.txtSpace = 0; oFont.Halign = 1; oFont.Valign = 2;
            byte[] fontName = Encoding.Default.GetBytes("宋体");
            byte[] strAreaTxtContent = Encoding.Default.GetBytes("111测试");
            err = Onbon6E1XCardSDK.dynamicArea_AddAreaWithTxt_5G(ip, 5005, Onbon6E1XCardSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, uAreaId, RunMode, Timeout, RelateAllPro, RelateProNum, RelateProSerial,
                            ImmePlay, uAreaX, uAreaY, uWidth, uHeight, oFrame, DisplayMode, ClearMode, Speed, StayTime, RepeatTime, oFont, fontName, strAreaTxtContent);
            Console.WriteLine("dynamicArea_AddAreaWithTxt_5G = " + err);
            //单区域图片 zc
            byte[] filePath = Encoding.Default.GetBytes("32.png");
            err = Onbon6E1XCardSDK.dynamicArea_AddAreaWithPic_5G(ip, 5005, Onbon6E1XCardSDK.E_ScreenColor_G56.eSCREEN_COLOR_DOUBLE, uAreaId, RunMode, Timeout, RelateAllPro, RelateProNum, RelateProSerial,
                            ImmePlay, uAreaX, uAreaY, uWidth, uHeight, oFrame, DisplayMode, ClearMode, Speed, StayTime, RepeatTime, filePath);
            Console.WriteLine("dynamicArea_AddAreaWithPic_5G = " + err);


        }
        public static void deleteprogram()
        {
            byte[] ip = Encoding.Default.GetBytes("192.168.89.105");
            //获取节目列表
            byte[] arrPointer = new byte[Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56))];
            Onbon6E1XCardSDK.GetDirBlock_G56 driBlock;
            int err = Onbon6E1XCardSDK.cmd_ofsReedDirBlock(ip, 5005, arrPointer);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56)));
            Marshal.Copy(arrPointer, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56)) * 0, dec, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56)));
            driBlock = (Onbon6E1XCardSDK.GetDirBlock_G56)Marshal.PtrToStructure(dec, typeof(Onbon6E1XCardSDK.GetDirBlock_G56));
            Marshal.FreeHGlobal(dec);
            //获取节目详细信息
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.GetDirBlock_G56)));
            Marshal.StructureToPtr(driBlock, aa, false);
            for (int i = 0; i < driBlock.fileNumber; i++)
            {
                byte[] fileAttrdata = new byte[Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56))];
                Onbon6E1XCardSDK.FileAttribute_G56 fileAttr;
                err = Onbon6E1XCardSDK.cmd_getFileAttr(aa, (ushort)i, fileAttrdata);
                IntPtr dec1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56)));
                Marshal.Copy(fileAttrdata, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56)) * 0, dec1, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.FileAttribute_G56)));
                fileAttr = (Onbon6E1XCardSDK.FileAttribute_G56)Marshal.PtrToStructure(dec1, typeof(Onbon6E1XCardSDK.FileAttribute_G56));
                Marshal.FreeHGlobal(dec1);
                //删除指定节目
                err = Onbon6E1XCardSDK.cmd_ofsDeleteFormatFile(ip, 5005, 1, fileAttr.fileName);
            }
        }


        //创建节目
        public static void Creat_Program_5()
        {
            Onbon6E1XCardSDK.EQprogramHeader header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x05;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x04;
            header.ProgramLifeSpan_ed = 0x12;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogramHeader)));
            Marshal.StructureToPtr(header, aa, false);
            int err = Onbon6E1XCardSDK.program_addProgram(aa);
            Console.WriteLine("program_addProgram:" + err);
        }
        public static void Creat_Program_6()
        {
            Onbon6E1XCardSDK.EQprogramHeader_G6 header;
            header.FileType = 0x00;
            header.ProgramID = 0;
            header.ProgramStyle = 0x00;
            header.ProgramPriority = 0x00;
            header.ProgramPlayTimes = 1;
            header.ProgramTimeSpan = 0;
            header.SpecialFlag = 0;
            header.CommExtendParaLen = 0x00;
            header.ScheduNum = 0;
            header.LoopValue = 0;
            header.Intergrate = 0x00;
            header.TimeAttributeNum = 0x00;
            header.TimeAttribute0Offset = 0x0000;
            header.ProgramWeek = 0xff;
            header.ProgramLifeSpan_sy = 0xffff;
            header.ProgramLifeSpan_sm = 0x03;
            header.ProgramLifeSpan_sd = 0x14;
            header.ProgramLifeSpan_ey = 0xffff;
            header.ProgramLifeSpan_em = 0x03;
            header.ProgramLifeSpan_ed = 0x14;
            header.PlayPeriodGrpNum = 0;
            IntPtr aa = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogramHeader_G6)));
            Marshal.StructureToPtr(header, aa, false);
            int err = Onbon6E1XCardSDK.program_addProgram_G6(aa);
            Console.WriteLine("program_addProgram:" + err);
        }
        //节目添加边框
        public static void ProgramAddFrame_5()
        {
            Onbon6E1XCardSDK.EQscreenframeHeader sfheader;
            sfheader.FrameDispFlag = 0x01;
            sfheader.FrameDispStyle = 0x01;
            sfheader.FrameDispSpeed = 0x10;
            sfheader.FrameMoveStep = 0x01;
            sfheader.FrameWidth = 2;
            sfheader.FrameBackup = 0;
            byte[] img = Encoding.Default.GetBytes("F:\\黄10.png");
            Onbon6E1XCardSDK.program_addFrame(ref sfheader, img);
        }
        public static void ProgramAddFrame_6()
        {
            Onbon6E1XCardSDK.EQscreenframeHeader_G6 sfheader;
            sfheader.FrameDispStype = 0x01;    //边框显示方式
            sfheader.FrameDispSpeed = 0x10;    //边框显示速度
            sfheader.FrameMoveStep = 0x01;     //边框移动步长
            sfheader.FrameUnitLength = 2;   //边框组元长度
            sfheader.FrameUnitWidth = 2;    //边框组元宽度
            sfheader.FrameDirectDispBit = 0;//上下左右边框显示标志位，目前只支持6QX-M卡 
            byte[] img = Encoding.Default.GetBytes("F:\\黄10.png");
            Onbon6E1XCardSDK.program_addFrame_G6(ref sfheader, img);
        }
        //创建区域
        public static void Creat_Area_5(byte AreaType, ushort x, ushort y, ushort w, ushort h, ushort areaID)
        {
            Onbon6E1XCardSDK.EQareaHeader aheader;
            aheader.AreaType = AreaType;
            aheader.AreaX = x;
            aheader.AreaY = y;
            aheader.AreaWidth = w;
            aheader.AreaHeight = h;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQareaHeader)));
            Marshal.StructureToPtr(aheader, bb, false);
            int err = Onbon6E1XCardSDK.program_AddArea(areaID, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);
        }
        public static void Creat_Area_6(byte AreaType, ushort x, ushort y, ushort w, ushort h, ushort areaID)
        {
            Onbon6E1XCardSDK.EQareaHeader_G6 aheader;
            aheader.AreaType = AreaType;
            aheader.AreaX = x;
            aheader.AreaY = y;
            aheader.AreaWidth = w;
            aheader.AreaHeight = h;
            aheader.BackGroundFlag = 0x00;
            aheader.Transparency = 101;
            aheader.AreaEqual = 0x00;
            Onbon6E1XCardSDK.EQSound_6G stSoundData = new Onbon6E1XCardSDK.EQSound_6G();
            stSoundData.SoundFlag = 0;
            stSoundData.SoundVolum = 0;
            stSoundData.SoundSpeed = 0;
            stSoundData.SoundDataMode = 0;
            stSoundData.SoundReplayTimes = 0;
            stSoundData.SoundReplayDelay = 0;
            stSoundData.SoundReservedParaLen = 0;
            stSoundData.Soundnumdeal = 0;
            stSoundData.Soundlanguages = 0;
            stSoundData.Soundwordstyle = 0;
            stSoundData.SoundDataLen = 0;
            byte[] t = new byte[1];
            t[0] = 0;
            stSoundData.SoundData = t;
            aheader.stSoundData = stSoundData;
            IntPtr bb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQareaHeader_G6)));
            Marshal.StructureToPtr(aheader, bb, false);
            int err = Onbon6E1XCardSDK.program_addArea_G6(areaID, bb);  //添加图文区域
            Console.WriteLine("program_AddArea:" + err);
        }
        //区域添加边框
        public static void AreaAddFrame_5(ushort areaID)
        {
            Onbon6E1XCardSDK.EQareaframeHeader afheader;
            afheader.AreaFFlag = 0x01;
            afheader.AreaFDispStyle = 0x01;
            afheader.AreaFDispSpeed = 0x08;
            afheader.AreaFMoveStep = 0x01;
            afheader.AreaFWidth = 3;
            afheader.AreaFBackup = 0;
            byte[] img = Encoding.Default.GetBytes("黄10.png");
            Onbon6E1XCardSDK.program_picturesAreaAddFrame(areaID, ref afheader, img);
        }
        public static void AreaAddFrame_6(ushort areaID)
        {
        }
        //添加内容
        public static void Creat_AddStr_5(ushort areaID)
        {
            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            Onbon6E1XCardSDK.EQpageHeader pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x03;
            pheader.ClearMode = 0x01;
            pheader.Speed = 30;
            pheader.StayTime = 0;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.arrMode = Onbon6E1XCardSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 12;
            pheader.color = (uint)0x01;
            pheader.fontBold = false;
            pheader.fontItalic = false;
            pheader.tdirection = Onbon6E1XCardSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQpageHeader)));
            Marshal.StructureToPtr(pheader, cc, false);
            int err = Onbon6E1XCardSDK.program_picturesAreaAddTxt(areaID, str, font, cc);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);
        }
        public static void Creat_AddStr_6(ushort areaID)
        {
            byte[] str = Encoding.Default.GetBytes("3Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            Onbon6E1XCardSDK.EQpageHeader_G6 pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x03;
            pheader.ClearMode = 0x01;
            pheader.Speed = 15;
            pheader.StayTime = 500;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.CartoonFrameRate = 0x00;
            pheader.BackNotValidFlag = 0x00;
            pheader.arrMode = Onbon6E1XCardSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 18;
            pheader.color = (uint)0x01;
            pheader.fontBold = 0;
            pheader.fontItalic = 0;
            pheader.tdirection = Onbon6E1XCardSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQpageHeader_G6)));
            Marshal.StructureToPtr(pheader, cc, false);
            int err = Onbon6E1XCardSDK.program_picturesAreaAddTxt_G6(areaID, str, font, cc);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);
        }
        //添加图片
        public static void Creat_Addimg_5(ushort areaID)
        {
            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            Onbon6E1XCardSDK.EQpageHeader pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x01;
            pheader.ClearMode = 0x01;
            pheader.Speed = 30;
            pheader.StayTime = 0;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.arrMode = Onbon6E1XCardSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 12;
            pheader.color = (uint)Onbon6E1XCardSDK.E_Color_G56.eGREEN;
            pheader.fontBold = false;
            pheader.fontItalic = false;
            pheader.tdirection = Onbon6E1XCardSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            //err = OnbonBx_sdk_dualSDK.program_picturesAreaAddTxt(0, str, font, ref pheader);
            //Console.WriteLine("program_picturesAreaAddTxt:" + err);
            byte[] img = Encoding.Default.GetBytes("32.png");
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQpageHeader)));
            Marshal.StructureToPtr(pheader, cc, false);
            int err = Onbon6E1XCardSDK.program_pictureAreaAddPic(areaID, 0, cc, img);
            Console.WriteLine("program_picturesAreaAddTxt:" + err);
        }
        public static void Creat_Addimg_6(ushort areaID)
        {
            byte[] str = Encoding.Default.GetBytes("Hello,123");
            byte[] font = Encoding.Default.GetBytes("宋体");
            //string str = "Hello,LED789";
            Onbon6E1XCardSDK.EQpageHeader_G6 pheader;
            pheader.PageStyle = 0x00;
            pheader.DisplayMode = 0x03;
            pheader.ClearMode = 0x01;
            pheader.Speed = 15;
            pheader.StayTime = 500;
            pheader.RepeatTime = 1;
            pheader.ValidLen = 0;
            pheader.CartoonFrameRate = 0x00;
            pheader.BackNotValidFlag = 0x00;
            pheader.arrMode = Onbon6E1XCardSDK.E_arrMode.eSINGLELINE;
            pheader.fontSize = 10;
            pheader.color = (uint)0x01;
            pheader.fontBold = 0;
            pheader.fontItalic = 0;
            pheader.tdirection = Onbon6E1XCardSDK.E_txtDirection.pNORMAL;
            pheader.txtSpace = 0;
            pheader.Valign = 2;
            pheader.Halign = 2;
            byte[] img = Encoding.Default.GetBytes("32.png");
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQpageHeader_G6)));
            Marshal.StructureToPtr(pheader, cc, false);
            int err = Onbon6E1XCardSDK.program_pictureAreaAddPic_G6(areaID, 0, cc, img);
            Console.WriteLine("program_pictureAreaAddPic_G6:" + err);
        }
        //添加时间
        public static void Creat_Addtime_5(ushort areaID)
        {
            Onbon6E1XCardSDK.EQtimeAreaData_G56 timeData2;
            timeData2.linestyle = Onbon6E1XCardSDK.E_arrMode.eMULTILINE;
            timeData2.color = (uint)Onbon6E1XCardSDK.E_Color_G56.eGREEN;
            timeData2.fontName = "";
            timeData2.fontSize = 16;
            timeData2.fontBold = 0;
            timeData2.fontItalic = 0;
            timeData2.fontUnderline = 0;
            timeData2.fontAlign = 1;  //0--左对齐，1-居中，2-右对齐
            timeData2.date_enable = true;
            timeData2.datestyle = Onbon6E1XCardSDK.E_DateStyle.eYYYY_MM_DD_MINUS;
            timeData2.time_enable = true;
            timeData2.timestyle = Onbon6E1XCardSDK.E_TimeStyle.eHH_MM_SS_COLON;
            timeData2.week_enable = true;
            timeData2.weekstyle = Onbon6E1XCardSDK.E_WeekStyle.eMonday_CHS;
            //program_timeAreaAddContent_G6(1,&timeData);
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQtimeAreaData_G56)));
            Marshal.StructureToPtr(timeData2, cc, false);
            int err = Onbon6E1XCardSDK.program_fontPath_timeAreaAddContent(areaID, cc);
            Console.WriteLine("program_fontPath_timeAreaAddContent:" + err);
        }
        public static void Creat_Addtime_6(ushort areaID)
        {
            Onbon6E1XCardSDK.EQtimeAreaData_G56 timeData2;
            timeData2.linestyle = Onbon6E1XCardSDK.E_arrMode.eMULTILINE;
            timeData2.color = (uint)Onbon6E1XCardSDK.E_Color_G56.eGREEN;
            timeData2.fontName = "";
            timeData2.fontSize = 16;
            timeData2.fontBold = 0;
            timeData2.fontItalic = 0;
            timeData2.fontUnderline = 0;
            timeData2.fontAlign = 1;  //0--左对齐，1-居中，2-右对齐
            timeData2.date_enable = true;
            timeData2.datestyle = Onbon6E1XCardSDK.E_DateStyle.eYYYY_MM_DD_MINUS;
            timeData2.time_enable = true;
            timeData2.timestyle = Onbon6E1XCardSDK.E_TimeStyle.eHH_MM_SS_COLON;
            timeData2.week_enable = true;
            timeData2.weekstyle = Onbon6E1XCardSDK.E_WeekStyle.eMonday_CHS;
            //program_timeAreaAddContent_G6(1,&timeData);
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQtimeAreaData_G56)));
            Marshal.StructureToPtr(timeData2, cc, false);
            int err = Onbon6E1XCardSDK.program_fontPath_timeAreaAddContent_G6(areaID, cc);
            Console.WriteLine("program_fontPath_timeAreaAddContent_G6:" + err);
        }
        //添加表盘
        public static void Creat_AddClock_5(ushort areaID)
        {
            Onbon6E1XCardSDK.EQAnalogClockHeader_G56 acheader;
            acheader.OrignPointX = 32;
            acheader.OrignPointY = 16;
            acheader.UnitMode = 0x00;
            acheader.HourHandWidth = 0x02;
            acheader.HourHandLen = 0x08;
            acheader.HourHandColor = 0x01;
            acheader.MinHandWidth = 0x02;
            acheader.MinHandLen = 0x0b;
            acheader.MinHandColor = 0x01;
            acheader.SecHandWidth = 0x02;
            acheader.SecHandLen = 0x0d;
            acheader.SecHandColor = 0x01;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQAnalogClockHeader_G56)));
            Marshal.StructureToPtr(acheader, cc, false);
            Onbon6E1XCardSDK.ClockColor_G56 ClockColor;
            ClockColor.Color369 = 0xff0000;
            ClockColor.ColorDot = 0xff0000;
            ClockColor.ColorBG = 0xff0000;
            int err = Onbon6E1XCardSDK.program_timeAreaAddAnalogClock(areaID, cc, Onbon6E1XCardSDK.E_ClockStyle.eCIRCLE, ref ClockColor);
        }
        public static void Creat_AddClock_6(ushort areaID)
        {
            Onbon6E1XCardSDK.EQAnalogClockHeader_G56 acheader;
            acheader.OrignPointX = 32;
            acheader.OrignPointY = 16;
            acheader.UnitMode = 0x00;
            acheader.HourHandWidth = 0x02;
            acheader.HourHandLen = 0x08;
            acheader.HourHandColor = 0x01;
            acheader.MinHandWidth = 0x02;
            acheader.MinHandLen = 0x0b;
            acheader.MinHandColor = 0x01;
            acheader.SecHandWidth = 0x02;
            acheader.SecHandLen = 0x0d;
            acheader.SecHandColor = 0x01;
            IntPtr cc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQAnalogClockHeader_G56)));
            Marshal.StructureToPtr(acheader, cc, false);
            Onbon6E1XCardSDK.ClockColor_G56 ClockColor;
            ClockColor.Color369 = 0xff0000;
            ClockColor.ColorDot = 0xff0000;
            ClockColor.ColorBG = 0xff0000;
            int err = Onbon6E1XCardSDK.program_timeAreaAddAnalogClock_G6(areaID, cc, Onbon6E1XCardSDK.E_ClockStyle.eCIRCLE, ClockColor);
        }
        //发送 节目
        public static void Net_SengProgram_5(byte[] ipAdder)
        {
            int err = Onbon6E1XCardSDK.cmd_ofsStartFileTransf(ipAdder, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            Onbon6E1XCardSDK.EQprogram program;
            err = Onbon6E1XCardSDK.program_IntegrateProgramFile(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogram)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogram)) * 0, dec, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogram)));
            program = (Onbon6E1XCardSDK.EQprogram)Marshal.PtrToStructure(dec, typeof(Onbon6E1XCardSDK.EQprogram));
            Marshal.FreeHGlobal(dec);

            err = Onbon6E1XCardSDK.cmd_ofsWriteFile(ipAdder, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = Onbon6E1XCardSDK.cmd_ofsEndFileTransf(ipAdder, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = Onbon6E1XCardSDK.program_deleteProgram();
            Console.WriteLine("program_deleteProgram:" + err);
        }
        public static void Net_SengProgram_6(byte[] ipAdder)
        {
            byte[] arrProgram = new byte[100];//[Marshal.SizeOf(typeof(OnbonBx_sdk_dualSDK.EQprogram))];
            Onbon6E1XCardSDK.EQprogram_G6 program;
            int err = Onbon6E1XCardSDK.program_IntegrateProgramFile_G6(arrProgram);
            Console.WriteLine("program_IntegrateProgramFile:" + err);
            IntPtr dec = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogram_G6)));
            Marshal.Copy(arrProgram, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogram_G6)) * 0, dec, Marshal.SizeOf(typeof(Onbon6E1XCardSDK.EQprogram_G6)));
            program = (Onbon6E1XCardSDK.EQprogram_G6)Marshal.PtrToStructure(dec, typeof(Onbon6E1XCardSDK.EQprogram_G6));
            Marshal.FreeHGlobal(dec);

            err = Onbon6E1XCardSDK.cmd_ofsStartFileTransf(ipAdder, 5005);
            Console.WriteLine("cmd_ofsStartFileTransf:" + err);

            err = Onbon6E1XCardSDK.cmd_ofsWriteFile(ipAdder, 5005, program.dfileName, program.dfileType, program.dfileLen, 1, program.dfileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = Onbon6E1XCardSDK.cmd_ofsWriteFile(ipAdder, 5005, program.fileName, program.fileType, program.fileLen, 1, program.fileAddre);
            Console.WriteLine("cmd_ofsWriteFile:" + err);
            err = Onbon6E1XCardSDK.cmd_ofsEndFileTransf(ipAdder, 5005);
            Console.WriteLine("cmd_ofsEndFileTransf:" + err);
            err = Onbon6E1XCardSDK.program_deleteProgram_G6();
            Console.WriteLine("program_deleteProgram:" + err);
        }
    }

}
